﻿
$(document).ready(function() {
    $("#frsavecontrollerdepartment").submit(function () {
        var submitdata = $(this).serialize();
        $("#frsavecontrollerdepartment").html("<div class='ajax-loadForm'></div>");
        $.ajax({
            method: "POST",
            url: "/permission/savecontrollerdepartment",
            data: submitdata,
            success: function (data) {
                $("#frsavecontrollerdepartment").html(data);
            }
        });
        return false;
    });
    
    $(".tbl-menueditor tbody tr").click(function () {
        $(this).addClass("row-selected");
        $(".tbl-menueditor tbody tr").not(this).removeClass('row-selected');
    });
    
    $(".fr-menudetail").submit(function () {
        var submitdata = $(this).serialize();
        $(".fr-menudetail").html("<div class='ajax-loadForm'></div>");
        $.ajax({
            method: "POST",
            url: "/permission/editmenulink",
            data: submitdata,
            success: function (data) {
                $(".fr-menudetail").html(data);
            }
        });
        return false;
    });
});

function controllerselected(controllerId) {
    $("#btn-deletecontroller").attr('href', '/permission/deletecontroller/' + controllerId);
    $(".controllerDepartment").html("<div class='ajax-loadForm'></div>");
    $.ajax({
        url: "/permission/getdepartment",
        data: { controllerId: controllerId },
        success: function (data) {
            $(".controllerDepartment").html(data);
        }
    });
}

function menudetail(menuid) {
    $(".fr-menudetail").html("<div class='ajax-loading'></div>");
    $.ajax({
        url: '/permission/getmenudetail',
        data: { id: menuid },
        success: function (data) {
            $(".fr-menudetail").html(data);
        }
    });
}